import React, { Component, Fragment } from 'react';
import { connect } from 'react-redux'
@connect(
	state => state
)
export default class Permissions extends Component {

	checkPerm = () => {
		if (this.props.perm.length === 0) {
			return this.props.children
		}
		return this.props.permissions.some(v => this.props.perm.includes(v)) ? this.props.children : null
	}

	render () {
		return (
			<Fragment>
				{
					this.checkPerm()
				}
			</Fragment>
		);
	}
}
